<cfparam name="Workshop_ID" type="integer" />
<cfparam name="mode" type="string" default="live" />
<cfparam name="returnView" type="string" default="followUp" />

<cfscript>
	workshopGateway = new assets.calgrants.com.gateway.WorkshopGateway();
	workshop = workshopGateway.query(Workshop_ID = Workshop_ID);
</cfscript>

<cfif workshop.RecordCount eq 1>

	<cfscript>
		if (mode eq "live") {
			studentGateway = new assets.calgrants.com.gateway.StudentGateway();
			students = studentGateway.query(Workshop_ID = workshop.Workshop_ID, followUp = 1);
		} else {
			studentPracticeGateway = new assets.calgrants.com.gateway.StudentPracticeGateway();
			students = studentPracticeGateway.query(Workshop_ID = workshop.Workshop_ID);
		}
	</cfscript>

	<cfoutput query="workshop">
		<h4>#Site#, #DateFormat(Workshop_Date, "dddd, mmmm d, yyyy")# #TimeFormat(Start_Time, "h:mmtt")#-#TimeFormat(End_Time, "h:mmtt")#</h4>
	</cfoutput>
	
	<cfif mode eq "practice">
		<p><strong>Practice Mode</strong></p>
	</cfif>
	
	<cfif students.RecordCount gt 0>
	
		<table class="table table-striped table-bordered">
			<thead>
				<tr>
					<th>Name</th>
					<th>Phone/E-mail</th>
					<th>First generation?</th>
					<th>Finish FAFSA/CA Dream Act?</th>
					<th>Why not?</th>
					<th>Want help?</th>
					<th>Follow Up Status</th>
					<th class="action"></th>
				</tr>
			</thead>
			<tbody>
				<cfoutput query="students">
					<tr>
						<td>#First_Name# #Last_Name#</td>
						<td>
							<cfif Len(Trim(Phone1)) gt 0>
								#Phone1#
							</cfif>
							<cfif Len(Trim(Phone1)) gt 0 AND Len(Trim(Phone2)) gt 0>
								<br />
							</cfif>
							<cfif Len(Trim(Phone2)) gt 0>
								#Phone2#
							</cfif>
							<cfif Len(Trim(Phone1)) gt 0 OR Len(Trim(Phone2)) gt 0>
								<br />
							</cfif>
							<a href="mailto:#Email#">#Email#</a>
						</td>
						<td>
							<cfif Q5 eq "1">
								Yes
							<cfelseif Q5 eq "2">
								No
							<cfelse>
								<span class="muted">Did not answer</span>
							</cfif>
						</td>
						<td>
							<cfif Q15 eq "1">
								Yes
							<cfelseif Q15 eq "2">
								Some
							<cfelseif Q15 eq "3">
								No
							<cfelse>
								<span class="muted">Did not answer</span>
							</cfif>
						</td>
						<td>
							<cfloop index="i" list="#Q16#">
								<cfswitch expression="#i#">
									<cfcase value="1">
										Thought I had to have taxes completed<br />
									</cfcase>
									<cfcase value="2">
										Didn't bring enough financial info with me<br />
									</cfcase>
									<cfcase value="3">
										Technical problem with computer<br />
									</cfcase>
									<cfcase value="4">
										Will submit later on the Internet<br />
									</cfcase>
									<cfcase value="5">
										Asked for AB 540 help<br />
									</cfcase>
								</cfswitch>
							</cfloop>
							<cfif Len(Trim(Q16_Other)) gt 0>#Q16_other#</cfif>
							<cfif Len(Trim(Q16)) eq 0 AND Len(Trim(Q16_Other)) eq 0>
								<span class="muted">Did not answer</span>
							</cfif>
						</td>
						<td>
							<cfif Q17 eq 1>
								Yes
							<cfelseif Q17 eq 2>
								Maybe
							<cfelseif Q17 eq 3>
								No
							<cfelse>
								<span class="muted">Did not answer</span>
							</cfif>
						</td>
						<td>
							<cfif Follow_Up_Status eq "Not Complete" OR ((Q15 eq 2 or Q15 eq 3) AND Len(Trim(Follow_Up_Status)) eq 0)>
								Not Complete
							<cfelseif Follow_Up_Status eq "Complete">
								Complete
							</cfif>
						</td>
						<td><a href="?view=editFollowUpRequest&returnView=#view#&Student_ID=#Student_ID#&passback=Workshop_ID,#Workshop_ID#" class="btn btn-success btn-block">Update</a></td>
					</tr>
				</cfoutput>
			</tbody>
		</table>
	<cfelse>
		<div class="alert alert-info notFound">No follow up requests</div>
	</cfif>
	
<cfelse>
	<div class="alert alert-info notFound">Workshop not found or insufficient permissions to perform this operation</div>
</cfif>